package com.didi.gulimall.member.web;

import com.alibaba.fastjson.JSON;
import com.didi.gulimall.common.to.OrderTo;
import com.didi.gulimall.member.service.MemberOrderWebService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * @Author 10626
 * @Create 2021/6/8 14:36
 */
@Controller
@Api("会员订单控制器")
@Slf4j
@RequestMapping("member")
public class MemberOrderWebController {
    @Autowired
    private MemberOrderWebService memberOrderWebService;

    @GetMapping("order.html")
    public String memberOrderHtml(Model model){
        List<OrderTo> orders =  memberOrderWebService.memberOrderHtml();
        log.info("返回数据:{}", JSON.toJSONString(orders));
        model.addAttribute("orders",orders);
        return "order";
    }
}
